
import matplotlib.pyplot as plt
import random
import numpy as np
import time

reps=1000
miu=1.4
theta=1.6


yi1=[]
yi2=[]
yi3=[]
res1=[]
res2=[]
res3=[]
for i in range(0,reps):
	xi=random.gauss(6,1.5)
	yi1.append(abs(int(round(xi))))
#for i in range(1,101):
#        res1.append(np.mean(yi1[0:i*10]))


#for i in range(0,reps):
#	xi=random.gauss(1.3,2)
#	yi2.append(abs(int(round(xi))))
#for i in range(1,101):
 #       res2.append(np.mean(yi2[0:i*10]))



for i in range(0,reps):
	xi=random.gauss(1.5,0.8)
	yi3.append(abs(int(round(xi))))
#for i in range(1,101):
#        res3.append(np.mean(yi3[0:i*10]))

        

avg1=np.mean(yi1)
var1=np.var(yi1)
#avg2=np.mean(yi2)
avg3=np.mean(yi3)
var3=np.var(yi3)
print "avg1:",avg1
print "var1:",var1
#print "avg2:",avg2
print "avg3:",avg3
print "var3:",var3





plt.subplot(211)
plt.plot(range(len(yi1)),yi1)
plt.yticks(range(0,21,3))
plt.xlabel(u"results")
plt.ylabel(u"error(us)")
'''plt.subplot(312)
plt.plot(range(len(yi2)),yi2,label="$3\ pac$")
plt.yticks(range(0,10))'''
plt.subplot(212)
plt.plot(range(len(yi3)),yi3)
plt.yticks(range(0,10))
plt.xlabel(u"results")
plt.ylabel(u"error(us)")
#plt.plot(reps,avg,label="$AVG$")
#plt.plot(range(repeats),avg3,'.',label="$3\ pkts$")
#plt.plot(range(repeats),avg4,':',label="$4 pkts$")
#plt.plot(range(repeats),avg5,'+',label="$5\ pkts$")
#plt.plot(range(repeats),avg6,',',label="$6 pkts$")
#plt.plot(range(repeats),avg7,'*',label="$7\ pkts$")

#plt.xticks(range(0,reps+1,reps/10))
#plt.yticks(range(0,20))
#plt.legend(bbox_to_anchor=(0.1,1.05),loc=3,ncol=6,borderaxespad=0)
plt.show()
